<template>
  <div class="s-user">
    <div class="s-user-item-left">
      <a href="javascript:;" @click="clickUser(item.userId)">
        <img
          :src="item.avatarUrl"
          :alt="item.nickname"
          class="s-user-item-pic"
        />
      </a>
    </div>
    <div class="s-user-item-main">
      <div>
        <h4 class="s-user-item-name" @click="clickUser(item.userId)">
          <a href="javascript:;">{{ item.nickname }}</a>
        </h4>
        <span class="s-user-item-remark" v-if="item.remarkName">
          ({{ item.remarkName }})
        </span>
        <span class="gender-male" v-if="item.gender == 1">
          <i class="iconfont">&#xec4c;</i>
        </span>
        <span class="gender-female" v-if="item.gender == 2">
          <i class="iconfont">&#xec4d;</i>
        </span>
      </div>
      <span :class="['user-btn', { 'user-btn-gray': item.followed }, 'follow']">
        <span v-if="item.followed">已关注</span>
        <span v-if="!item.followed">关注</span>
      </span>
      <div class="s-user-item-act">
        <span class="my-act-span">
          <a href="javascript:;" @click="clickEvent(item.userId)">
            动态
            <em class="em-count">{{ item.eventCount }}</em>
          </a>
        </span>
        <span class="my-act-span">
          <a href="javascript:;" @click="clickFollows(item.userId)">
            关注
            <em class="em-count">{{ item.follows }}</em>
          </a>
        </span>
        <span class="my-act-span">
          <a href="javascript:;" @click="clickFans(item.userId)">
            粉丝
            <em class="em-count">{{ item.followeds }}</em>
          </a>
        </span>
      </div>
      <div class="s-user-item-sign">
        {{ item.signature }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  methods: {
    clickEvent(id) {
      this.playUserEvent(id);
    },
    clickFollows(id) {
      this.playUserFollows(id);
    },
    clickFans(id) {
      this.playUserFans(id);
    },
    clickUser(id) {
      this.playUserDetail(id);
    },
  },
};
</script>

<style>
.s-user {
  position: relative;
  width: 100%;
}
.s-user-item-left {
  float: left;
  width: 80px;
  height: 80px;
  overflow: hidden;
}
.s-user-item-left a {
  display: block;
  width: 80px;
  height: 80px;
}
.s-user-item-left .s-user-item-pic {
  width: 80px;
  height: 80px;
}
.s-user-item-main {
  margin-left: 90px;
}
.s-user-item-name {
  display: inline-block;
  height: 36px;
  line-height: 36px;
  font-size: 16px;
  font-weight: 400;
  cursor: pointer;
}
.s-user-item-name a:hover {
  text-decoration: underline;
}
.s-user-item-remark {
  margin-left: 5px;
  font-size: 14px;
  color: #999;
}
.s-user-item-main .gender-male .iconfont,
.s-user-item-main .gender-female .iconfont {
  margin-left: 5px;
  font-size: 16px;
}
.s-user-item-main .gender-male {
  color: rgb(38, 166, 228);
}
.s-user-item-main .gender-female {
  color: rgb(255, 190, 216);
}
.s-user .follow {
  position: absolute;
  right: 10px;
  top: 2px;
}
.s-user .user-btn {
  padding: 6px 8px;
  color: #000;
  background-color: #fff;
  border-radius: 5px;
  border: 1px solid #999;
  cursor: pointer;
}
.s-user .user-btn.user-btn-gray {
  color: #ccc;
  background-color: #f2f2f2;
  border: 1px solid #ccc;
}
.s-user-item-act {
  height: 20px;
  line-height: 20px;
  font-size: 12px;
  color: #666;
}
.s-user-item-act .my-act-span {
  margin-right: 10px;
}
.s-user-item-act .my-act-span:hover {
  text-decoration: underline;
}
.s-user-item-act .em-count {
  font-style: normal;
  color: var(--color-theme);
}
.s-user-item-sign {
  margin-right: 10px;
  width: 100%;
  height: 24px;
  line-height: 24px;
  font-size: 12px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>